// 组合去重
/**
 * @param {number[]} nums
 * @return {number[][]}
 */
 var subsetsWithDup = function(nums) {
    const res = [];
    const path = [];
    const n = nums.length;
    let sortSum = nums.sort((a,b)=>a -b)
    const dfs = (index,used) => {
        res.push(path.slice());
        for(let i = index; i < n; i++) {
            if(i> 0 && nums[i]==nums[i-1] && used[i-1]==false) 
                   continue;
                    path.push(nums[i]);
                    used[i] = true;
                    dfs(i+1,used) ;
                    used[i] = false;
                    path.pop();
                    
                }
         }
    dfs(0,[])
    return res;
};